{literal}
<script src="http://www.google.com/jsapi" language="javascript"></script>
<script type="text/javascript">
function initialize() {
	this.lat = 0;
	this.lng = 0;
	this.zoom = 8;
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("mapa-najblizszych-lokalizacji"));
		var geocoder = new GClientGeocoder();
		geocoder.getLatLng("{/literal}{$selectedLokalizacja}{literal}Ireland",	function( point ) {
			if (!point) {
				this.zoom = 8;
				this.lat = 50;
				this.lng = -8;
			} else {			
				this.zoom = 12;		
				this.lat = point.lat();
				this.lng = point.lng();	
			}
		    //map.setCenter(new GLatLng(this.lat,this.lng), this.zoom);
		    map.setUIToDefault();
		});
		GDownloadUrl("{/literal}{$smarty.const.HTTP_URL}{$page},KatalogTA,listaXMLLokalizacjiProduktowLatLng,{$kateg.tacID}.html?s1={$smarty.request.s1}&s2={$smarty.request.s2}{literal}", function(data){
			xml = GXml.parse(data);
			markers  = xml.documentElement.getElementsByTagName("marker");
			addMarkers(markers, map);
			map.setCenter(new GLatLng(markers[0].getAttribute("lat"),markers[0].getAttribute("lng")), this.zoom);
		});
  }
}

function addMarkers(markers,map){
	
	for (var i = 0; i < markers.length; i++){
	    var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
	                            parseFloat(markers[i].getAttribute("lng")));
        var name = markers[i].getAttribute("name");
        var adress = markers[i].getAttribute("address");
        var url = "{/literal}{$settings_katalog_ta.mainpage|default:$page},,show_offert,"+markers[i].getAttribute("pID")+","+markers[i].getAttribute("cID")+".html";
        var foto = "<div class=\"thumbnail\" onclick=\"document.location='{$smarty.const.HTTP_URL}{$settings_katalog_ta.mainpage|default:$page},,show_offert,"+markers[i].getAttribute("pID")+","+markers[i].getAttribute("cID")+".html';\" style=\"background-image: url({$smarty.const.HTTP_URL}photo,/public/users/{$smarty.server.HTTP_HOST|replace:'www.':''}/KatalogTA/"+markers[i].getAttribute("pID")+"_logo.jpg,100,100,100.jpg); width: 100px; height: 100px; _height:100px;  background-repeat: no-repeat; float: left; padding: 2px; {literal}\"></div>";
		var marker = createMarker(point,name,adress,url,foto);
	   map.addOverlay(marker);
	}
	
}

function createMarker (point,name,adress,url,foto){
	var marker = new GMarker(point);
	var html_ = foto+"<h3><a href=\""+url+"\">"+name +"</a></h3><p><a href=\""+url+"\">"+adress+"</a></p>";
	GEvent.addListener(marker, 'click', function(){
		marker.openInfoWindowHtml(html_);
	});
	return marker;
}

$(document).ready(function(){
	initialize();
});
</script>
{/literal}
<div id="mapa-najblizszych-lokalizacji" style="width: 1268px; height: 250px;"></div>